<?php

if (!defined('BASEPATH'))
	exit('No direct script access allowed');

class Log_admin_activities_m extends Base_model {
	public $primary_key = 'log_id';
	public $_table = 'log_admin_activities';
	
	function auto_add($add = array())
	{
		$arr_insert = array();
		$arr_insert['admin_id'] = $this->admin->id;
		$arr_insert['session_id'] = $this->session->session_id;
		$arr_insert['ip_address'] = $this->input->ip_address();
		$arr_insert['log_title'] = @$this->auth->get_info($this->current_permission)->permission_title;
		$arr_insert['log_summary'] = NULL;
		$arr_insert['log_url_string'] = uri_string();
		$arr_insert['log_type'] = 'auto';
		$arr_insert['log_time'] = time();
		$arr_insert['log_permission_current'] = $this->current_permission;
		$arr_insert = array_merge($arr_insert, $add);
		return $this->insert($arr_insert);
	}

	function add($title = '', $summary = '', $type = '', $current_permission = '')
	{
		return $this->auto_add(array(
			'log_title' =>$title,
			'log_summary' =>$summary,
			'log_type' =>$type
			));
	}
}
